//-------------------------------------------------------------------
//	Copyright (c) 2010-2012  Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_OS_EVENTS_H
#define _UX_OS_EVENTS_H

#include "../Defines/Defines.h"
#include "../Enums/KeyCodes.h"

namespace Engine
{
namespace UXTypes
{

	//
	// Key Event
	//

	struct TKeyEvent
	{
		e_key::type		eKey;
		wchar			wChar;
		char			cChar;
		bool			bPressed;
	};


	//
	// Mouse Key Event
	//

	struct TMouseKeyEvent
	{
		int		iDeltaWheel;
		bool	bButton1Changed : 1,
				bButton1Pressed : 1,
				
				bButton2Changed : 1,
				bButton2Pressed : 1,
				
				bButton3Changed : 1,
				bButton3Pressed : 1,
				
				bButton4Changed : 1,
				bButton4Pressed : 1,
				
				bButton5Changed : 1,
				bButton5Pressed : 1;
	};


	//
	// Mouse Event
	//

	struct TMouseEvent
	{
		int		iX,
				iY;
		bool	bDelta;	// delta or absolute
	};


	//
	// Message
	//

	struct TMessage
	{
		enum EWindowMsg
		{
			UNKNOWN		= 0,
			PAUSE,		// WM_KILLFOCUS
			RESUME,		// WM_SETFOCUS
			RESIZE,		// WM_SIZE
			MINIMIZED,	// SIZE_MINIMIZED
			MAXIMIZED,	// SIZE_MAXIMIZED
			MOVE,		// WM_MOVE
			DESTROY,	// WM_DESTROY
		};

		EWindowMsg	eMsg;
	};


	//
	// User Event
	//

	struct TUserEvent
	{
		int		iParam1,
				iParam2;
	};


	//
	// Event
	//

	struct TWindowEvent
	{
		e_win_event::type	eEventType;
		union
		{
			TKeyEvent			sKey;
			TMouseKeyEvent		sMouseKey;
			TMouseEvent			sMouse;
			TMessage			sMsg;
			TUserEvent			sUser;
		}
		sEvent;
		///
		TWindowEvent(): eEventType(e_win_event::UNKNOWN) {}
	};
	

	//
	// Window Event Listener
	//

	class _EXPORT_ IWindowEventListener
	{
	public:
		virtual void ProcessMessage(const TWindowEvent &sEvent) = 0;
	};


	//
	// Window Updater
	//

	class _EXPORT_ IWindowUpdater
	{
	public:
		virtual void OnUpdate() = 0;
	};

//-------------------------------------------------------------------

}	// UXTypes
}	// Engine

#endif	// _UX_OS_EVENTS_H